﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;


using BL.Client.BudgetManageBL;

namespace UI.BudgetManage
{
    public partial class BMMain : Form
    {
        public BMMain()
        {
            InitializeComponent();
        }

        private Form ParentForm;
        public BudgetManageServerice BMS;

        public BMMain(Form parent, BudgetManageServerice bms)
        {
            this.ParentForm = parent;
            this.BMS = bms;
            InitializeComponent();
            this.IsMdiContainer = true;
            this.ParentForm.Visible = false;
            this.tsslUserRealName.Text = this.BMS.IUA.GetUserRealName(this.BMS.UserId);
        
        }

        private void BMMain_Load(object sender, EventArgs e)
        {
            
        }

        private void BMMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.ParentForm.Close();
        }

        private void SelectFunction(Form childform)
        {
            if (childform == null)
                childform = new Form();
            childform.MdiParent = this;
            childform.Show();
        }

        private void SelectFunctionNeedIndentify(Form childform)
        {
            
            ChildForm.SNIndentify.SNIndentify ci = new ChildForm.SNIndentify.SNIndentify(childform);
            this.SelectFunction(ci);
        }

        private void SelectFunctionNeedIndentify(Form childform, object sender)
        {
            ToolStripMenuItem item = (ToolStripMenuItem)sender;
            ChildForm.SNIndentify.SNIndentify ci = new ChildForm.SNIndentify.SNIndentify(childform, item.Text);
            this.SelectFunction(ci);
        }

        private void BudgetCheckToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.SelectFunction(new ChildForm.FinanacialBudgetApprove.FinancialBudgetApprove());
        }

        private void IBRToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.SelectFunctionNeedIndentify(new ChildForm.LocalBudgetReport.InputBudgetReport());
        }

        private void FBRToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.SelectFunction(new ChildForm.LocalBudgetReport.FileBudgetReport());
        }

        

        private void BPToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.SelectFunctionNeedIndentify(new ChildForm.BudgetPay.InputBudgetPay(), sender);
        }

        private void BAQToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.SelectFunction(new ChildForm.BudgetQuery.BudgetAdvancedQuery());
        }

        private void PPLQToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.SelectFunction(new ChildForm.PayLogQuery.PayPriceLogQuery());
        }

        

        private void JKToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.SelectFunctionNeedIndentify(new ChildForm.BudgetBorrow.UserBudgetBorrow(), sender);
        }

        private void chToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.SelectFunctionNeedIndentify(new ChildForm.BudgetPay.BorrowPayBack(), sender);
        }

        private void toolStripMenuItem1_Click(object sender, EventArgs e)
        {
            this.SelectFunction(new ChildForm.BudgetPay.ExecutePay());
        }
        
        

        

        

    }
}